import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:largefriends/res.dart';
import 'package:largefriends/res/lf_color.dart';
import 'package:largefriends/res/lf_double_ext.dart';
import 'package:largefriends/res/lf_fonts.dart';
import 'package:largefriends/res/lf_text_style.dart';
import 'package:largefriends/res/strings/lf_strings.dart';
import 'package:largefriends/widgets/lf_button.dart';

class CommonFailedPage extends StatelessWidget {
  final Function retry;
  const CommonFailedPage({
    super.key,
    required this.retry,
  });

  @override
  Widget build(BuildContext context) {
    return Column(
      crossAxisAlignment: CrossAxisAlignment.center,
      mainAxisAlignment: MainAxisAlignment.center,
      children: [
        ShaderMask(
            shaderCallback: (Rect bounds) {
              return LinearGradient(
                begin: const Alignment(-0.5, -0.9),
                end: const Alignment(0.5, 0.9),
                colors: [colorFF007F, colorFF007F, colorBF00FF, colorBF00FF],
              ).createShader(Offset.zero & bounds.size);
            },
            blendMode: BlendMode.srcATop,
            child: Image.asset(
              Res.ic_failure,
              width: 120.w,
              fit: BoxFit.cover,
              color: color210215,
            )),
        20.h.sbh,
        Text(
          strSlowConnectionTip.tr,
          style: lfTextStyle(sp: 16.sp, fontFamily: fontMedium),
          textAlign: TextAlign.center,
        ),
        20.h.sbh,
        Padding(
          padding: EdgeInsets.symmetric(horizontal: 30.w),
          child: LfButton(
            enabled: true,
            text: strTapToTry.tr,
            onPress: (){
              retry.call();
            },
          ),
        ),
        40.h.sbh,
      ],
    );
  }
}
